home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.7 KB | 150 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawClip.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef DRAWCLIP_H
- #include "DrawClip.h"
- #endif
-
- #ifndef DRAWPART_H
- #include "DrawPart.h"
- #endif
-
- #ifndef BASESHP_H
- #include "BaseShp.h"
- #endif
-
- #ifndef BOUNDSHP_H
- #include "BoundShp.h"
- #endif
-
- #ifndef LINESHP_H
- #include "LineShp.h"
- #endif
-
- #ifndef OVALSHP_H
- #include "OvalShp.h"
- #endif
-
- #ifndef RECTSHP_H
- #include "RectShp.h"
- #endif
-
- #ifndef RRECTSHP_H
- #include "RRectShp.h"
- #endif
-
- #ifndef TEXTSHP_H
- #include "TextShp.h"
- #endif
-
- #ifndef DRAWFRM_H
- #include "DrawFrm.h"
- #endif
-
- #ifndef DRAWPRXY_H
- #include "DrawPrxy.h"
- #endif
-
- #ifndef DRAWCONT_H
- #include "DrawCont.h"
- #endif
-
- // ----- Part Includes -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdraw
- #endif
-
- //========================================================================================
- // class CDrawFacetClipper
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // CDrawFacetClipper::CDrawFacetClipper
- //---------------------------------------------------------------------------------------
-
- CDrawFacetClipper::CDrawFacetClipper(Environment *ev, CDrawPart* part):
- FW_CFacetClipper(ev, part),
- fDrawPart(part)
- {
- }
-
- //---------------------------------------------------------------------------------------
- // CDrawFacetClipper::~CDrawFacetClipper
- //---------------------------------------------------------------------------------------
-
- CDrawFacetClipper::~CDrawFacetClipper()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawFacetClipper::ClipEmbeddedFacets
- //----------------------------------------------------------------------------------------
-
- void CDrawFacetClipper::ClipEmbeddedFacets(Environment *ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFacet* containingFacet,
- ODShape* limitShape)
- {
- // ----- If no proxy shape we don't have anything to do -----
- if (fDrawPart->GetDrawContent()->GetProxyShapeCount() == 0)
- return;
-
- FW_CPoint extent;
- embeddingFrame->GetContentExtent(ev, extent);
- FW_CRect extentRect(FW_kFixed0, FW_kFixed0, extent.x, extent.y);
-
- FW_CRect limitRect;
- if (limitShape)
- limitRect = FW_GetShapeBoundingBox(ev, limitShape);
- else
- limitRect = extentRect;
-
- // ----- Create a temporary shape -----
- FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
- aqTempShape->SetGeometryMode(ev, kODLoseGeometry);
-
- // ----- Create the working clip -----
- FW_CAcquiredODShape aqWorkingClip = AcquireWorkingClip(ev, embeddingFrame, containingFacet, NULL);
-
- // ----- Go through my shapes (backward) ------
- CDrawContentShapeIterator ite(fDrawPart->GetDrawContent());
- for (CBaseShape* shape = ite.Last(); ite.IsNotComplete(); shape = ite.Previous())
- {
- FW_CRect dragRect;
- shape->GetDragRect(dragRect);
- if (limitRect.IsIntersecting(dragRect))
- shape->SubtractToWindowClip(ev, this, containingFacet, aqWorkingClip, aqTempShape);
- }
- }
-